<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    @yield('title')
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" type="text/css" href="/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.css">

    <script src="/lib/jquery-1.11.1.min.js" type="text/javascript"></script>

    <script src="/lib/jQuery-Knob/js/jquery.knob.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $(".knob").knob();
        });
    </script>
    <link rel="stylesheet" type="text/css" href="/css/theme.css">
    <script src="/lib/swal/sweetalert.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="/lib/swal/sweetalert.css">
    <script src="/lib/wdate/WdatePicker.js" type="text/javascript"></script>
    {{--<link rel="stylesheet" type="text/css" href="/css/premium.css">--}}
</head>
<body class=" theme-blue">

<!-- Demo page code -->

<script type="text/javascript">
    $(function() {
        var match = document.cookie.match(new RegExp('color=([^;]+)'));
        if(match) var color = match[1];
        if(color) {
            $('body').removeClass(function (index, css) {
                return (css.match (/\btheme-\S+/g) || []).join(' ')
            })
            $('body').addClass('theme-' + color);
        }

        $('[data-popover="true"]').popover({html: true});

    });

    $(document).ready(function(){
        //点击图片放大
        $(".pimg").click(function(){  
            var _this = $(this);//将当前的pimg元素作为_this传入函数
            $("#bigimg").attr("src", _this.attr("src"));
            $("#outerdiv").fadeIn("fast");//淡入显示#outerdiv及.pimg  
            var windowW = $(window).width();//获取当前窗口宽度  
            var windowH = $(window).height();//获取当前窗口高度  
            var realWidth = $("#bigimg").width();//获取图片真实宽度  
            var realHeight= $("#bigimg").height();//获取图片真实高度 
            console.log(realWidth); 
            var imgWidth  = 0;
            var imgHeight = 0;  
            var scale = 0.8;//缩放尺寸，当图片真实宽度和高度大于窗口宽度和高度时进行缩放 
            if(realHeight>windowH*scale){
                console.log(1); 
                imgHeight = windowH*scale;//如大于窗口高度，图片高度进行缩放  
                imgWidth = imgHeight/realHeight*realWidth;//等比例缩放宽度  
                if(imgWidth>windowW*scale){
                    imgWidth = windowW*scale;//再对宽度进行缩放  
                }
            }else if(realWidth>windowW*scale){
                console.log(2); 
                imgWidth = windowW*scale;//如大于窗口宽度，图片宽度进行缩放  
                imgHeight = imgWidth/realWidth*realHeight;//等比例缩放高度  
            }else{
                console.log(3); 
                imgWidth = realWidth;  
                imgHeight = realHeight;  
            }
            $(bigimg).css("width",imgWidth);//以最终的宽度对图片缩放 
            var w = (windowW-imgWidth)/2;//计算图片与窗口左边距  
            var h = (windowH-imgHeight)/2;//计算图片与窗口上边距  
            $("#innerdiv").css({"top":h, "left":w});//设置#innerdiv的top和left属性  
            $("#outerdiv").click(function(){
                $(this).fadeOut("fast"); 
            });
        });  
    });
</script>
<style type="text/css">
    #line-chart {
        height:300px;
        width:800px;
        margin: 0px auto;
        margin-top: 1em;
    }
    .navbar-default .navbar-brand, .navbar-default .navbar-brand:hover {
        color: #fff;
    }

    #outerdiv{
        position:fixed;
        top:0;left:0;
        background:rgba(0,0,0,0.7);
        z-index:2;width:100%;height:100%;display:none;
    }
    .pimg{cursor:pointer;}
</style>

<script type="text/javascript">
    $(function() {
        var uls = $('.sidebar-nav > ul > *').clone();
        uls.addClass('visible-xs');
        $('#main-menu').append(uls.clone());
    });
</script>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
@include('layouts.header')

@include('layouts.leftmenu')
<script src="/js/leftMenu.js"></script>
@yield('content')
<div id="outerdiv">
    <div id="innerdiv" style="position:absolute;" >
        <img id="bigimg" src="" />
    </div>
</div>
<script src="/lib/bootstrap/js/bootstrap.js"></script>
<?php
$success = app()->request->session()->get('success');
$notice = app()->request->session()->get('notice');
$error = app()->request->session()->get('error');
?>
<?php
if ($notice) {
?>
<script type="text/javascript">
    swal("提示!", "<?php echo $notice; ?>", "warning")
</script>
<?php }
if ($error) {
?>
<script type="text/javascript">
    swal("错误!", "<?php echo $error; ?>", "error")
</script>
<?php }
if ($success) {
?>
<script type="text/javascript">
    swal("成功!", "<?php echo $success; ?>", "success")
</script>
<?php } ?>
<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function() {
        $('.demo-cancel-click').click(function(){return false;});
    });
</script>

</body>
</html>
